package Schedule::Chronic::Distributed::TaskTimes;

=head1 NAME

Schedule::Chronic::Distributed::TaskTimes - Task Times

=head1 SYNOPSIS

use Schedule::Chronic::Distributed::TaskTimes;

.. TODO.. 

=head1 DESCRIPTION

Task Requirement class, maps tasks to requirements and required levels.

=head1 METHODS

=head2 ACCESSORS

=over

=item id 

=item task 

=item start_time

=item end_time

=back

=head2 METHODS PROVIDED ELSEWHERE

Additional methods for the Monitor Web UI are provided in
Schedule::Chronic::Distributed::Monitor::TaskTimes package.

These are :

=over

=item display_columns 

=back

=cut

use strict;

use Time::Piece;
use Time::Seconds;

use base qw(Schedule::Chronic::Distributed::DBI);

__PACKAGE__->table('task_times');
__PACKAGE__->columns(All => qw/id task start_time end_time/);

__PACKAGE__->has_a(task => 'Schedule::Chronic::Distributed::Task');

__PACKAGE__->add_trigger(after_create => sub {
    my $self = shift;
    my $task = $self->task;
    unless ($task->current_due) {
      $task->_update_times;
    }
});


=head1 SEE ALSO

Schedule::Chronic::Distributed

Schedule::Chronic::Distributed::Task

=head1 AUTHOR

aaron trevena, E<lt>aaron.trevena@gmail.comE<gt>

=head1 COPYRIGHT AND LICENSE

Copyright (C) 2006 by Aaron Trevena

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.8.5 or,
at your option, any later version of Perl 5 you may have available.

=cut

1;
